/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import com.qihoo.gamecenter.sdk.common.IDispatcherCallback;
import com.qihoo.gamecenter.sdk.common.d.a.a;
import com.qihoo.gamecenter.sdk.common.g.a;
import com.qihoo.gamecenter.sdk.common.g.b;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.pay.modules.Pay;
import java.lang.ref.WeakReference;

public class DispatcherPay implements com.qihoo.gamecenter.sdk.common.f {
    private static WeakReference a = new WeakReference(null);
    private static int b = 0;
    private static int c = 2;

    public void startOutSDK(com.qihoo.gamecenter.sdk.common.b paramb, int paramInt, Intent paramIntent) {
        com.qihoo.gamecenter.sdk.pay.k.c.a("Dispatcher", new Object[] { "startOutSDK() called, functionCode is ",
                Integer.valueOf(paramInt) });
        Activity localActivity1 = (Activity) paramb;
        com.qihoo.gamecenter.sdk.pay.k.c.a(localActivity1, com.qihoo.gamecenter.sdk.common.d.a.a(a.a.ef));
        synchronized (a) {
            boolean bool2 = paramIntent.getBooleanExtra("has_saved_instance_state", false);
            int i = localActivity1.getResources().getConfiguration().orientation;
            Activity localActivity2 = (Activity) a.get();
            if ((b == paramInt) && (localActivity2 != null) && (localActivity2.isFinishing() != true) && (c == i)
                    && (!(bool2))) {
                localActivity1.finish();
                return;
            }
            b = paramInt;
            a = new WeakReference(localActivity1);
            c = i;
        }
        boolean bool1 = paramIntent.getBooleanExtra("screen_orientation", true);
        com.qihoo.gamecenter.sdk.common.i.e.a(bool1, localActivity1);
        s.a(localActivity1);
        Object localObject1 = null;
        switch (paramInt) {
        case 257:
        case 258:
            paramIntent.putExtra("show_autologin_switch", true);
            paramIntent.putExtra("hide_guide", true);
            localObject1 = new com.qihoo.gamecenter.sdk.pay.c.a();
            break;
        case 1025:
            localObject1 = new Pay();
            break;
        case 259:
            localObject1 = new com.qihoo.gamecenter.sdk.login.plugin.e.e();
            break;
        case 261:
        case 2054:
        case 2055:
            localObject1 = new com.qihoo.gamecenter.sdk.login.plugin.e.a();
            break;
        case 260:
            localObject1 = new com.qihoo.gamecenter.sdk.login.plugin.e.d();
            break;
        case 2049:
            localObject1 = new com.qihoo.gamecenter.sdk.support.b.b();
            break;
        case 2050:
            localObject1 = new com.qihoo.gamecenter.sdk.support.b.d();
            break;
        case 2057:
            localObject1 = new com.qihoo.gamecenter.sdk.support.b.c();
            break;
        case 263:
            localObject1 = new com.qihoo.gamecenter.sdk.login.plugin.e.f();
            break;
        case 1028:
            localObject1 = new com.qihoo.gamecenter.sdk.pay.modules.a();
            break;
        case 2059:
            localObject1 = new com.qihoo.gamecenter.sdk.support.b.f();
            break;
        default:
            com.qihoo.gamecenter.sdk.pay.k.c.b("Dispatcher",
                    new Object[] { "Unrecognized function code: ", Integer.valueOf(paramInt) });
        }
        if (localObject1 == null)
            return;
        ((g.a) localObject1).run(paramb, paramIntent);
    }

    public void a(Context paramContext, int paramInt, Intent paramIntent, IDispatcherCallback paramIDispatcherCallback) {
        com.qihoo.gamecenter.sdk.pay.k.c.a("Dispatcher",
                new Object[] { "execute() called, functionCode is ", Integer.valueOf(paramInt) });
        com.qihoo.gamecenter.sdk.pay.k.c.a(paramContext, com.qihoo.gamecenter.sdk.common.d.a.a(a.a.ef));
        Object localObject = null;
        switch (paramInt) {
        case 1026:
            localObject = new com.qihoo.gamecenter.sdk.pay.modules.c();
            break;
        case 2052:
            localObject = new com.qihoo.gamecenter.sdk.support.b.a(paramContext);
            break;
        default:
            com.qihoo.gamecenter.sdk.pay.k.c.b("Dispatcher", new Object[] { "Unrecognized execute function code: ",
                    Integer.valueOf(paramInt) });
        }
        if (localObject == null)
            return;
        ((g.b) localObject).a(paramContext, paramIntent, paramIDispatcherCallback);
    }

    public static void a() {
        if (a == null)
            return;
        a.clear();
    }
}